<?php

use think\migration\Seeder;

class SourceNcForecastData extends Seeder
{
    public function run()
    {
        $table = $this->table('source_bureau_air_quality_nc_forecast');
        $rows = [
            //5个站点
            [
                'pollutant'      => 'PM2.5',    //因子（SO2，AQI）
                'data'           => $this->data(),  //气象的nc网格化数据是61*51=3111，不需要坐标
                'predict_time'   => date('Y-m-d H', time()) . ':00:00',   //预报时间-7天168小时
                'publish_time'   => date('Y-m-d H', time()) . ':00:00',                           //发布时间-7天168小时
                'create_time'    => date('Y-m-d H:i:s', time()),
                'is_to_tsinghua' => '1',
            ],
        ];
        $table->insert($rows)->save();
    }

    public function data()
    {
        $data = file_get_contents(__DIR__ . '/json/nc.json');
        return $data;
    }
}
